<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>ES6 示例</title>
</head>

<body>
    <h2>ES6 示例</h2>
    <script>
        function sum(x, y, z) {
            let total = 0;
            if (x) {
                total += x
            };
            if (y) {
                total += y
            };
            if (z) {
                total += z
            };
            console.log(`total:${total}`)
        }
        sum(5, "", 9);
        //console.log('total:${total}');
        function Sum(...m) {
            let total = 0;
            for (var i of m) {
                total += i;
            }
            console.log(`total:${total}`);
        }
        Sum(8, 5, 2, 8, 10);

        let sUm = (...m) => {
            let total = 0;
            for (var i of m) {
                total += i;
            }
            console.log(`total:${total}`);
        }
        sUm(5, 10, 5, 52, 7);
        var [x, y] = [4, 8]
        console.log(...[4, 8]);
        let arr1 = [1, 5, 'g', 's', 'f'];
        let arr2 = ['a', 'sl', 'kd', 'hduz', 'q'];
        console.log("concat:" + arr1.concat(arr2));

        console.log(`${[...arr1, ...arr2]}`);
    </script>
</body>

</html>